package _5_facade

import (
	"errors"
	"fmt"
)

type ShapeMaker struct {
	rect   rectangle
	circle circle
	square square
}

func (sm ShapeMaker) Draw(shape string) error {

	if shape == "rectangle" {
		sm.rect.draw()
		return nil
	}

	if shape == "circle" {
		sm.circle.draw()
		return nil
	}

	if shape == "square" {
		sm.square.draw()
		return nil
	}

	return errors.New("unsupported " + shape + " shape")
}

type shape interface {
	draw()
}

// rectangle
type rectangle struct {
}

func (r rectangle) draw() {
	fmt.Println("Rectangle Shape")
}

type circle struct {
}

func (c circle) draw() {
	fmt.Println("Circle Shape")
}

type square struct {
}

func (s square) draw() {
	fmt.Println("Square Shape")
}
